using Microsoft.Rtc.Collaboration.Presence;

namespace Lync.Widget.Library.Presence
{
    public static class AvailabilityRangeConverter
    {
        public static PresenceAvailability Convert(long availability)
        {
            var result = PresenceAvailability.None;

            var status = AvailabilityToStatusConverter.Convert(availability);

            switch (status.ToLower())
            {
                case "unavailable": result = PresenceAvailability.Offline; break;
                case "away": result = PresenceAvailability.Away; break;
                case "available": result = PresenceAvailability.Online; break;
                case "busy": result = PresenceAvailability.Busy; break;
                case "do not disturb": result = PresenceAvailability.DoNotDisturb; break;
                case "be right back": result = PresenceAvailability.BeRightBack; break;
            }

            return result;
        }
    }
}